package 注解Annotation.自定义注解;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;

public class ReadAnnotationAppMain {
    public static void main(String[] args) throws NoSuchMethodException {
        Class clazz = TestAnnotation.class;
        Method method = clazz.getMethod("test");
        for(Annotation annotation : method.getAnnotations()){
            System.out.println(annotation.annotationType());
        }

        // todo 读取注解的内容，可以根据注解的内容作为相应功能的配置，来实现相应的功能
        PrimaryProperty primaryProperty = method.getAnnotation(PrimaryProperty.class);
        System.out.println(primaryProperty.abc());
        System.out.println(primaryProperty.defaultValue());
        System.out.println(Arrays.asList(primaryProperty.defaultValues()));
        System.out.println(primaryProperty.targetClass());
    }
}
